package name.jautzy.esi.server;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.LinkedList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class EveDbRemEquipFromApplet extends HttpServlet {
	@Override
	public void doPost(HttpServletRequest req, HttpServletResponse res)
	throws ServletException, IOException {
		ObjectInputStream inputFromApplet = null;
		EdbDAO dao = new EdbDAO();
		List<Long> eqIds = new LinkedList<Long>();
		try {
			inputFromApplet = new ObjectInputStream(req.getInputStream());
			while (true) {
				eqIds.add((Long)inputFromApplet.readObject());
			}
				
		} catch (IOException e) {
			dao.removeEquip(eqIds);
		} catch (Exception e) {
			throw new ServletException(e);
		} finally {
			inputFromApplet.close();
		}
	}
}
